import { getPickingOrders } from '@/api/picking-order'
import Pagination from '@/components/Pagination/index'


export default {
  name: 'PickingOrder',
  components: { Pagination },

  data(){
    return{
      list: null,
      total: 0,
      listLoading: true,
      listQuery: {
        page: 1,
        limit: 20,
      }
    }
  },

  created(){
    this.getList()
  },

  methods:{

    getList() {
      this.listLoading = true
      getPickingOrders(this.listQuery).then(response => {
        this.list = response.picking_orders
        this.total = response.total
        this.listLoading = false
      }).catch(error => {
        this.list = []
        this.total = 0
        this.listLoading = false
        Promise.reject(error)
      })
    },

    handleSearch() {
      this.list = []
      this.total = 0
      this.getList()
    },

    pack(id){
      this.$router.push({
        path: '../picking-order-storage/index',
        query:{
          id: id
        }
      })
    }

  }
}
